﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Data;

namespace XMLDataEditor
{
    /// <summary>
    /// DlgListTablename.xaml 的交互逻辑
    /// </summary>
    public partial class DlgListTablename : Window
    {
        DataSet _ds;

        public DlgListTablename(DataSet ds)
        {
            InitializeComponent();
            //tbList.Text = text;

            _ds = ds;

            tbList.Items.Clear();

            foreach (DataTable dt in ds.Tables)
            {
                tbList.Items.Add(dt.TableName);
            }
        }

        private void btClose_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        private void btClear_Click(object sender, RoutedEventArgs e)
        {
            foreach (string item in tbList.SelectedItems)
            {
                _ds.Tables[item].Rows.Clear();
            }

            MessageBox.Show("清除成功");
        }
    }
}
